--[[
	
	Name: Advanced Questbook
	By: Crypton

]]
function AdvQuestBookCore_OnLoad(this)
	this:RegisterEvent("VARIABLES_LOADED");
	this:RegisterEvent("SCRIPT_RUNTIME_ERROR");
end

function AdvQuestBookCore_EventHandler(this, event)
	if (event == "VARIABLES_LOADED") then
		--[[

		Until we get quest data dumped for quests in these languages,
		we will load English data files. We will however make special
		exception for the Quest Dumper so we are able to gather the data
		needed.

		]]
		AQB_SERVER = GetCurrentRealm();
		--[[

		Have to test if the save per character function is reliable and works as AQB needs,
		if it doesn't, then I will have to use this method and make it also save by account
		so configs for multi-chars and multi-accounts will work properly.

		AQB_ACCT = GetAccountName();

		]]
		AQB_CurPlayer = UnitName("player");
		if (not AQB_IsEmpty(AdvQuestBook_Config, true)) then
			SaveVariables("AdvQuestBook_Config");
		end
		if (not AQB_IsEmpty(AdvQuestBook_Dumped_Quests, true)) then
			SaveVariables("AdvQuestBook_Dumped_Quests");
		end
		AdvQuestBookConfig_Defaults();
		AQB_Def_ChannelSets = {};
		AQB_COUNT_DUMPED = 0;
		AdvQuestBook_GlobalQuestIndex = {};
		AdvQuestBook_GlobalSharedIndex = {};
		AdvQuestBook_GlobalSearchIndex = {};
		AQB_TEMP_QUESTS = {};
		AdvQuestBook_DefaultWhisperStatus();
	end
end
